package com.example.kafkasp.Config;

import org.springframework.stereotype.Component;

import java.util.Properties;
/**
 * @author CHENTAIWEN
 * @create 2022/8/25 11:07
 */
@Component
public class Proper {

    public Properties props() {
        //1.属性配置：端口、缓冲内存、最大连接数、key序列化、value序列化等等
        Properties props = new Properties();
        props.put("bootstrap.servers", "localhost:9092");
        props.put("acks", "1");
        props.put("retries", 0);
        props.put("batch.size", 16384);
        props.put("linger.ms", 1); //发送延迟 1秒
        props.put("buffer.memory", 33554432); //管理的最大内存
        props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
        props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
        return props;
    }
}
